<template>
  <div style="padding: 10px">
    <Row label="视图宽度">
      <a-input-number placeholder="请输入单据名称" v-model="editingView.pageWidth"/>
    </Row>
  </div>
</template>
<script>
import Row from '@/components/hhd/design/FormDesigner/base/Row.vue';
import {createProps} from '@/utils';
import {createFormDefinition, createFormView} from '@/components/hhd/design/FormDesigner/types';

export default {
  name: 'ViewConfig',
  components: {Row},
  props: {
    formDefinition: createProps(Object, createFormDefinition),
    selectedView: createProps(String),
  },
  data() {
    return {
      editingView: createFormView(),
    };
  },
  methods: {
    findView() {
      // console.log(this.selectedView)
      // console.log(this.formDefinition.views)
      // console.log(this.formDefinition.views.find(v => v.id === this.selectedView))
      this.editingView = this.formDefinition.views.find(v => v.id === this.selectedView) || createFormView();
    },
  },
  watch: {
    selectedView: {
      handler() {
        this.findView();
      },
      immediate: true,
    }
  }
};
</script>